package com.sojson.project.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.sojson.project.dao.LeaveWordDao;
import com.sojson.project.entity.po.LeaveWord;
import com.sojson.project.service.LeaveWordService;

/**
 * 留言表Service实现类
 * 
 * @author liu
 * @date 2021-10-27
 */
@Service
public class LeaveWordServiceImpl implements LeaveWordService {

    @Resource
    private LeaveWordDao leaveWordDaoImpl;

    /**
     * 单条插入
     * 
     * @param dto
     * @return
     */
    @Override
    public int insert(LeaveWord dto) {
        int insert = leaveWordDaoImpl.insert(dto);
        return insert;
    }

    /**
     * 批量插入
     * 
     * @param dto
     * @return
     */
    @Override
    public int insertList(LeaveWord dto) {
        int insertList = leaveWordDaoImpl.insertList(dto.getLeaveWords());
        return insertList;
    }

    /**
     * 通过对象批量删除(物理删除)
     * 
     * @param dto
     * @return
     */
    @Override
    public int deleteByDto(LeaveWord dto) {
        int deleteByDto = leaveWordDaoImpl.deleteByDto(dto);
        return deleteByDto;
    }

    /**
     * 统计全部数量
     * 
     * @return
     */
    @Override
    public int countAll() {
        int countAll = leaveWordDaoImpl.countAll();
        return countAll;
    }

    /**
     * 查询所有
     * 
     * @return
     */
    @Override
    public List<LeaveWord> listAll() {
        List<LeaveWord> findAll = leaveWordDaoImpl.listAll();
        return findAll;
    }

    /**
     * 根据对象统计数量
     * 
     * @param dto
     * @return
     */
    @Override
    public int countByDto(LeaveWord dto) {
        int countByDto = leaveWordDaoImpl.countByDto(dto);
        return countByDto;
    }

    /**
     * 根据对象查询
     * 
     * @param dto
     * @return
     */
    @Override
    public List<LeaveWord> listByDto(LeaveWord dto) {
        List<LeaveWord> findByDto = leaveWordDaoImpl.listByDto(dto);
        return findByDto;
    }

    /**
     * 通过id删除(物理删除)
     * 
     * @param id
     * @return
     */
    @Override
    public int deleteById(Integer id) {
        int deleteById = leaveWordDaoImpl.deleteById(id);
        return deleteById;
    }

    /**
     * 通过id数组删除(物理删除)
     * 
     * @param ids
     * @return
     */
    @Override
    public int deleteByIds(Integer[] ids) {
        int deleteByIds = leaveWordDaoImpl.deleteByIds(ids);
        return deleteByIds;
    }

    /**
     * 通过id更新(全部更新)
     * 
     * @param dto
     * @return
     */
    @Override
    public int updateAllById(LeaveWord dto) {
        int updateAllById = leaveWordDaoImpl.updateAllById(dto);
        return updateAllById;
    }

    /**
     * 通过id列表更新(全部更新)(更新内容相同)
     * 
     * @param dto
     * @return
     */
    @Override
    public int updateAllByIdList(LeaveWord dto) {
        int updateAllByIdList = leaveWordDaoImpl.updateAllByIdList(dto);
        return updateAllByIdList;
    }

    /**
     * 通过id列表更新(全部更新)(更新内容不相同)
     * 
     * @param dto
     * @return
     */
    @Override
    public int updateDtoListAllById(LeaveWord dto) {
        int updateDtoListAllById = leaveWordDaoImpl.updateDtoListAllById(dto.getLeaveWords());
        return updateDtoListAllById;
    }

    /**
     * 通过id更新(局部更新)
     * 
     * @param dto
     * @return
     */
    @Override
    public int updateById(LeaveWord dto) {
        int updateById = leaveWordDaoImpl.updateById(dto);
        return updateById;
    }

    /**
     * 通过id列表更新(局部更新)(更新内容相同)
     * 
     * @param dto
     * @return
     */
    @Override
    public int updateByIdList(LeaveWord dto) {
        int updateByIdList = leaveWordDaoImpl.updateByIdList(dto);
        return updateByIdList;
    }

    /**
     * 通过id列表更新(局部更新)(更新内容不相同)
     * 
     * @param dto
     * @return
     */
    @Override
    public int updateDtoListById(LeaveWord dto) {
        int updateDtoListById = leaveWordDaoImpl.updateDtoListById(dto.getLeaveWords());
        return updateDtoListById;
    }

    /**
     * 通过id查询
     * 
     * @param id
     * @return
     */
    @Override
    public LeaveWord findById(Integer id) {
        LeaveWord findById = leaveWordDaoImpl.findById(id);
        return findById;
    }

    /**
     * 通过id数组查询
     * 
     * @param ids
     * @return
     */
    @Override
    public List<LeaveWord> findByIds(Integer[] ids) {
        List<LeaveWord> findByIds = leaveWordDaoImpl.findByIds(ids);
        return findByIds;
    }

    /**
     * 通过对象查询id列表
     * 
     * @param dto
     * @return
     */
    @Override
    public List<Integer> findIdByDto(LeaveWord dto) {
        List<Integer> findIdByDto = leaveWordDaoImpl.findIdByDto(dto);
        return findIdByDto;
    }

    /**
     * 清空数据(物理清空)
     */
    @Override
    public int clear() {
        return leaveWordDaoImpl.clear();
    }

    /**
     * 通过id更新状态(局部更新)
     * 
     * @param dto
     * @return
     */
    @Override
    public int changeStatus(LeaveWord leaveWord) {
        return leaveWordDaoImpl.updateById(leaveWord);
    }

}